//============================================================================
// Name        : Lab.cpp
// Author      : Anthea Neums, Jonas Halbach
//			   :
// Description : Uses the PatternGenomAnalyser to match Genoms and Patterns.
//============================================================================

#include <iostream>
#include <fstream>
#include <string>
#include "FileReader.h"
#include "PatternHandler.h"
#include "ThreadingPatternGenomAnalyser.h"
#include "Found.h"
#include "Test.h"
#include <Windows.h>
#include <WinBase.h>
#include <list>

#define THREAD_COUNT 1
#define RELEASE

//using namespace std;

#ifdef TEST

int main() {

	cout << "Test begin:" << endl;

	//testFileLoading();
	//testPatternMatching();

	showTestGenom();


	cout << "Test end!" << endl;
	
	char c;
	cin >> c;
	return 0;
}



#else

int main() {

	
	
	//FileReader *contentReader = new FileReader((char *)"txt/testfiles/testpattern.txt");
	//char *testPattern = (char *)"txt/testfiles/testpattern.txt";
	//char *testGenom = (char *)"txt/testfiles/testgenom.txt";
	char *testPattern = (char *)"txt/GenomPattern3.txt";
    char *testGenom = (char *)"txt/GenomProbe.txt";
	//char *testPattern = (char *)"txt/testfiles/Pattern_short.txt";
	//char *testGenom = (char *)"txt/testfiles/GenomProbe_short.txt";

	//char *testPattern = (char *)"txt/testfiles/leerPattern.txt";
	//char *testGenom = (char *)"txt/testfiles/LeerGenom.txt";

	//char *testPattern = (char *)"txt/testfiles/A_Pattern.txt";
	//char *testGenom = (char *)"txt/testfiles/A_Genom.txt";
	//FileReader *reader = new FileReader(testPattern);
	//cout << "getContent"<<reader->getContent() << endl;

	
	int ntime=0;
	LARGE_INTEGER ntime1,ntime2;
	LARGE_INTEGER freq;
	QueryPerformanceFrequency(&freq);
	QueryPerformanceCounter(&ntime1);

	algorithm::ThreadingPatternGenomAnalyser *patternGenomAnalyser = new algorithm::ThreadingPatternGenomAnalyser(testPattern, testGenom, 16, THREAD_COUNT);

	patternGenomAnalyser->findSimilarStrings();

	QueryPerformanceCounter(&ntime2);
	//get ntime in millisecs
	ntime = (ntime2.QuadPart-ntime1.QuadPart)/(freq.QuadPart/1000);

	patternGenomAnalyser->printFounds();

	cout << endl << "Time to calculate matching Genoms to Patterns: " << ntime << endl << endl;

	delete patternGenomAnalyser;

	char c;
	cin >> c;

	return 0;
}

#endif
